jdk/src/solaris/native/sun/nio/ch/Sctp.h
author chegar
Thu, 16 Apr 2009 17:42:00 +0100
changeset 2542 d859108aea12
child 3072 a801b122142f
permissions -rw-r--r--
4927640: Implementation of the sctp protocol Summary: An implementation-specific API for the Stream Control Transmission Protocol Reviewed-by: alanb, michaelm, jccollet
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     1
/*
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     4
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    10
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    15
 * accompanied this code).
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    16
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    20
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    23
 * have any questions.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    24
 */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    25
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    26
#ifndef SUN_NIO_CH_SCTP_H
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    27
#define SUN_NIO_CH_SCTP_H
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    28
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    29
#ifdef __solaris__
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    30
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    31
#define _XPG4_2
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    32
#define __EXTENSIONS__
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    33
#include <sys/socket.h>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    34
#include <netinet/sctp.h>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    35
#include "jni.h"
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    36
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    37
/* Current Solaris headers don't comply with draft rfc */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    38
#ifndef SCTP_EOF
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    39
#define SCTP_EOF MSG_EOF
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    40
#endif
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    41
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    42
#ifndef SCTP_UNORDERED
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    43
#define SCTP_UNORDERED MSG_UNORDERED
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    44
#endif
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    45
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    46
/* The current version of the socket API extension shipped with Solaris does
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    47
 * not define the following options that the Java API (optionally) supports */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    48
#ifndef SCTP_EXPLICIT_EOR
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    49
#define SCTP_EXPLICIT_EOR -1
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    50
#endif
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    51
#ifndef SCTP_FRAGMENT_INTERLEAVE
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    52
#define SCTP_FRAGMENT_INTERLEAVE -1
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    53
#endif
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    54
#ifndef SCTP_SET_PEER_PRIMARY_ADDR
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    55
#define SCTP_SET_PEER_PRIMARY_ADDR -1
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    56
#endif
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    57
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    58
/* Function types to support dynamic linking of socket API extension functions
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    59
 * for SCTP. This is so that there is no linkage depandancy during build or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    60
 * runtime for libsctp.*/
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    61
typedef int sctp_getladdrs_func(int sock, sctp_assoc_t id, void **addrs);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    62
typedef int sctp_freeladdrs_func(void* addrs);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    63
typedef int sctp_getpaddrs_func(int sock, sctp_assoc_t id, void **addrs);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    64
typedef int sctp_freepaddrs_func(void *addrs);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    65
typedef int sctp_bindx_func(int sock, void *addrs, int addrcnt, int flags);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    66
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    67
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    68
#else /* __linux__ */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    69
#include <stdint.h>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    70
#include <linux/types.h>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    71
#include <sys/socket.h>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    72
#include <netinet/in.h>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    73
#include "jni.h"
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    74
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    75
//Causes compiler error if not found, should make warning and uncomment
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    76
/*#include <netinet/sctp.h>*/
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    77
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    78
#ifndef IPPROTO_SCTP
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    79
#define IPPROTO_SCTP    132
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    80
#endif
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    81
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    82
/* The current version of lksctp does
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    83
 * not define the following option that the Java API (optionally) supports */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    84
#ifndef SCTP_EXPLICIT_EOR
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    85
#define SCTP_EXPLICIT_EOR -1
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    86
#endif
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    87
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    88
/* Definitions taken from lksctp-tools-1.0.8/src/include/netinet/sctp.h */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    89
#ifndef SCTP_INITMSG
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    90
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    91
enum sctp_optname {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    92
        SCTP_RTOINFO,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    93
#define SCTP_RTOINFO SCTP_RTOINFO
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    94
        SCTP_ASSOCINFO,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    95
#define SCTP_ASSOCINFO SCTP_ASSOCINFO
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    96
        SCTP_INITMSG,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    97
#define SCTP_INITMSG SCTP_INITMSG
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    98
        SCTP_NODELAY,   /* Get/set nodelay option. */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    99
#define SCTP_NODELAY    SCTP_NODELAY
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   100
        SCTP_AUTOCLOSE,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   101
#define SCTP_AUTOCLOSE SCTP_AUTOCLOSE
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   102
        SCTP_SET_PEER_PRIMARY_ADDR,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   103
#define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   104
        SCTP_PRIMARY_ADDR,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   105
#define SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   106
        SCTP_ADAPTATION_LAYER,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   107
#define SCTP_ADAPTATION_LAYER SCTP_ADAPTATION_LAYER
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   108
        SCTP_DISABLE_FRAGMENTS,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   109
#define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   110
        SCTP_PEER_ADDR_PARAMS,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   111
#define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   112
        SCTP_DEFAULT_SEND_PARAM,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   113
#define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   114
        SCTP_EVENTS,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   115
#define SCTP_EVENTS SCTP_EVENTS
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   116
        SCTP_I_WANT_MAPPED_V4_ADDR,  /* Turn on/off mapped v4 addresses  */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   117
#define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   118
        SCTP_MAXSEG,    /* Get/set maximum fragment. */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   119
#define SCTP_MAXSEG     SCTP_MAXSEG
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   120
        SCTP_STATUS,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   121
#define SCTP_STATUS SCTP_STATUS
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   122
        SCTP_GET_PEER_ADDR_INFO,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   123
#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   124
        SCTP_DELAYED_ACK_TIME,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   125
#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   126
        SCTP_CONTEXT,   /* Receive Context */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   127
#define SCTP_CONTEXT SCTP_CONTEXT
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   128
        SCTP_FRAGMENT_INTERLEAVE,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   129
#define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   130
        SCTP_PARTIAL_DELIVERY_POINT,    /* Set/Get partial delivery point */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   131
#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   132
        SCTP_MAX_BURST,         /* Set/Get max burst */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   133
#define SCTP_MAX_BURST SCTP_MAX_BURST
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   134
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   135
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   136
enum sctp_sac_state {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   137
        SCTP_COMM_UP,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   138
        SCTP_COMM_LOST,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   139
        SCTP_RESTART,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   140
        SCTP_SHUTDOWN_COMP,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   141
        SCTP_CANT_STR_ASSOC,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   142
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   143
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   144
enum sctp_spc_state {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   145
        SCTP_ADDR_AVAILABLE,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   146
        SCTP_ADDR_UNREACHABLE,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   147
        SCTP_ADDR_REMOVED,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   148
        SCTP_ADDR_ADDED,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   149
        SCTP_ADDR_MADE_PRIM,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   150
        SCTP_ADDR_CONFIRMED,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   151
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   152
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   153
enum sctp_sinfo_flags {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   154
        SCTP_UNORDERED = 1,  /* Send/receive message unordered. */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   155
        SCTP_ADDR_OVER = 2,  /* Override the primary destination. */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   156
        SCTP_ABORT=4,        /* Send an ABORT message to the peer. */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   157
        SCTP_EOF=MSG_FIN,    /* Initiate graceful shutdown process. */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   158
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   159
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   160
enum sctp_sn_type {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   161
        SCTP_SN_TYPE_BASE     = (1<<15),
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   162
        SCTP_ASSOC_CHANGE,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   163
        SCTP_PEER_ADDR_CHANGE,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   164
        SCTP_SEND_FAILED,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   165
        SCTP_REMOTE_ERROR,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   166
        SCTP_SHUTDOWN_EVENT,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   167
        SCTP_PARTIAL_DELIVERY_EVENT,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   168
        SCTP_ADAPTATION_INDICATION,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   169
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   170
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   171
typedef enum sctp_cmsg_type {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   172
        SCTP_INIT,              /* 5.2.1 SCTP Initiation Structure */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   173
#define SCTP_INIT SCTP_INIT
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   174
        SCTP_SNDRCV,            /* 5.2.2 SCTP Header Information Structure */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   175
#define SCTP_SNDRCV SCTP_SNDRCV
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   176
} sctp_cmsg_t;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   177
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   178
enum sctp_msg_flags {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   179
        MSG_NOTIFICATION = 0x8000,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   180
#define MSG_NOTIFICATION MSG_NOTIFICATION
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   181
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   182
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   183
#define SCTP_BINDX_ADD_ADDR 0x01
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   184
#define SCTP_BINDX_REM_ADDR 0x02
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   185
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   186
typedef __s32 sctp_assoc_t;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   187
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   188
struct sctp_initmsg {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   189
        __u16 sinit_num_ostreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   190
        __u16 sinit_max_instreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   191
        __u16 sinit_max_attempts;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   192
        __u16 sinit_max_init_timeo;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   193
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   194
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   195
struct sctp_sndrcvinfo {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   196
        __u16 sinfo_stream;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   197
        __u16 sinfo_ssn;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   198
        __u16 sinfo_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   199
        __u32 sinfo_ppid;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   200
        __u32 sinfo_context;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   201
        __u32 sinfo_timetolive;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   202
        __u32 sinfo_tsn;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   203
        __u32 sinfo_cumtsn;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   204
        sctp_assoc_t sinfo_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   205
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   206
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   207
struct sctp_event_subscribe {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   208
        __u8 sctp_data_io_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   209
        __u8 sctp_association_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   210
        __u8 sctp_address_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   211
        __u8 sctp_send_failure_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   212
        __u8 sctp_peer_error_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   213
        __u8 sctp_shutdown_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   214
        __u8 sctp_partial_delivery_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   215
        __u8 sctp_adaptation_layer_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   216
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   217
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   218
struct sctp_send_failed {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   219
        __u16 ssf_type;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   220
        __u16 ssf_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   221
        __u32 ssf_length;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   222
        __u32 ssf_error;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   223
        struct sctp_sndrcvinfo ssf_info;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   224
        sctp_assoc_t ssf_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   225
        __u8 ssf_data[0];
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   226
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   227
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   228
struct sctp_assoc_change {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   229
        __u16 sac_type;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   230
        __u16 sac_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   231
        __u32 sac_length;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   232
        __u16 sac_state;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   233
        __u16 sac_error;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   234
        __u16 sac_outbound_streams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   235
        __u16 sac_inbound_streams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   236
        sctp_assoc_t sac_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   237
        __u8 sac_info[0];
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   238
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   239
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   240
struct sctp_shutdown_event {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   241
        __u16 sse_type;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   242
        __u16 sse_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   243
        __u32 sse_length;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   244
        sctp_assoc_t sse_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   245
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   246
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   247
struct sctp_paddr_change {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   248
        __u16 spc_type;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   249
        __u16 spc_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   250
        __u32 spc_length;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   251
        struct sockaddr_storage spc_aaddr;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   252
        int spc_state;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   253
        int spc_error;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   254
        sctp_assoc_t spc_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   255
} __attribute__((packed, aligned(4)));
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   256
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   257
struct sctp_remote_error {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   258
        __u16 sre_type;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   259
        __u16 sre_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   260
        __u32 sre_length;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   261
        __u16 sre_error;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   262
        sctp_assoc_t sre_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   263
        __u8 sre_data[0];
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   264
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   265
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   266
struct sctp_adaptation_event {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   267
        __u16 sai_type;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   268
        __u16 sai_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   269
        __u32 sai_length;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   270
        __u32 sai_adaptation_ind;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   271
        sctp_assoc_t sai_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   272
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   273
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   274
struct sctp_setprim {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   275
        sctp_assoc_t            ssp_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   276
        struct sockaddr_storage ssp_addr;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   277
} __attribute__((packed, aligned(4)));
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   278
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   279
struct sctp_setpeerprim {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   280
        sctp_assoc_t            sspp_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   281
        struct sockaddr_storage sspp_addr;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   282
} __attribute__((packed, aligned(4)));
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   283
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   284
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   285
struct sctp_pdapi_event {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   286
        __u16 pdapi_type;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   287
        __u16 pdapi_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   288
        __u32 pdapi_length;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   289
        __u32 pdapi_indication;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   290
        sctp_assoc_t pdapi_assoc_id;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   291
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   292
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   293
union sctp_notification {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   294
        struct {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   295
                __u16 sn_type;             /* Notification type. */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   296
                __u16 sn_flags;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   297
                __u32 sn_length;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   298
        } sn_header;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   299
        struct sctp_assoc_change sn_assoc_change;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   300
        struct sctp_paddr_change sn_paddr_change;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   301
        struct sctp_remote_error sn_remote_error;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   302
        struct sctp_send_failed sn_send_failed;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   303
        struct sctp_shutdown_event sn_shutdown_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   304
        struct sctp_adaptation_event sn_adaptation_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   305
        struct sctp_pdapi_event sn_pdapi_event;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   306
};
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   307
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   308
#endif /* SCTP_INITMSG */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   309
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   310
/* Function types to support dynamic linking of socket API extension functions
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   311
 * for SCTP. This is so that there is no linkage depandancy during build or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   312
 * runtime for libsctp.*/
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   313
typedef int sctp_getladdrs_func(int sd, sctp_assoc_t id, struct sockaddr **addrs);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   314
typedef int sctp_freeladdrs_func(struct sockaddr *addrs);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   315
typedef int sctp_getpaddrs_func(int sd, sctp_assoc_t id, struct sockaddr **addrs);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   316
typedef int sctp_freepaddrs_func(struct sockaddr *addrs);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   317
typedef int sctp_bindx_func(int sd, struct sockaddr *addrs, int addrcnt, int flags);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   318
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   319
#endif /* __linux__ */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   320
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   321
sctp_getladdrs_func* nio_sctp_getladdrs;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   322
sctp_freeladdrs_func* nio_sctp_freeladdrs;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   323
sctp_getpaddrs_func* nio_sctp_getpaddrs;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   324
sctp_freepaddrs_func* nio_sctp_freepaddrs;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   325
sctp_bindx_func* nio_sctp_bindx;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   326
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   327
jboolean loadSocketExtensionFuncs(JNIEnv* env);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   328
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   329
#endif /* !SUN_NIO_CH_SCTP_H */