/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include "Sctp.h"
#include "jni.h"
#include "jni_util.h"
#include "nio_util.h"
#include "nio.h"
#include "net_util.h"
#include "net_util_md.h"
#include "sun_nio_ch_SctpNet.h"
#include "sun_nio_ch_SctpStdSocketOption.h"
return JNI_VERSION_1_2;
}
before closing them for real */
/**
* Loads the native sctp library that contains the socket extension
* functions, as well as locating the individual functions.
* There will be a pending exception if this method returns false.
*/
dlerror());
return JNI_FALSE;
}
if ((nio_sctp_getladdrs = (sctp_getladdrs_func*)
dlerror());
return JNI_FALSE;
}
if ((nio_sctp_freeladdrs = (sctp_freeladdrs_func*)
dlerror());
return JNI_FALSE;
}
if ((nio_sctp_getpaddrs = (sctp_getpaddrs_func*)
dlerror());
return JNI_FALSE;
}
if ((nio_sctp_freepaddrs = (sctp_freepaddrs_func*)
dlerror());
return JNI_FALSE;
}
if ((nio_sctp_bindx = (sctp_bindx_func*)
dlerror());
return JNI_FALSE;
}
if ((nio_sctp_peeloff = (sctp_peeloff_func*)
dlerror());
return JNI_FALSE;
}
return JNI_TRUE;
}
{
char *xn;
switch (errorValue) {
case EINPROGRESS: /* Non-blocking connect */
return 0;
case EPROTO:
break;
case ECONNREFUSED:
break;
case ETIMEDOUT:
break;
case EHOSTUNREACH:
break;
case EADDRINUSE: /* Fall through */
case EADDRNOTAVAIL:
break;
default:
break;
}
errno = errorValue;
return IOS_THROWN;
}
/*
* Class: sun_nio_ch_SctpNet
* Method: init
* Signature: ()V
*/
return;
}
preCloseFD = sp[0];
}
/*
* Class: sun_nio_ch_SctpNet
* Method: socket0
* Signature: (Z)I
*/
int fd;
#ifdef AF_INET6
#else
#endif
/* Try to load the socket API extension functions */
return 0;
}
if (fd < 0) {
}
/* Enable events */
//event.sctp_peer_error_event = 1;
//event.sctp_partial_delivery_event = 1;
//event.sctp_adaptation_layer_event = 1;
}
return fd;
}
/*
* Class: sun_nio_ch_SctpNet
* Method: bindx
* Signature: (I[Ljava/net/InetAddress;IIZ)V
*/
if (addrsLength < 1)
return;
return;
}
for (i=0; i<addrsLength; i++) {
&sa_len, preferIPv6) != 0) {
return;
}
tmpSap++;
}
SCTP_BINDX_REM_ADDR) != 0) {
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: listen0
* Signature: (II)V
*/
}
/*
* Class: sun_nio_ch_SctpNet
* Method: connect0
* Signature: (ILjava/net/InetAddress;I)I
*/
int rv;
return IOS_THROWN;
}
if (rv != 0) {
if (errno == EINPROGRESS) {
return IOS_UNAVAILABLE;
return IOS_INTERRUPTED;
}
}
return 1;
}
/*
* Class: sun_nio_ch_SctpNet
* Method: close0
* Signature: (I)V
*/
if (fd != -1) {
if (rv < 0)
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: preClose0
* Signature: (I)V
*/
if (preCloseFD >= 0) {
}
}
void initializeISA
if (isaCls == 0) {
CHECK_NULL(c);
"(Ljava/net/InetAddress;I)V");
}
}
int port = 0;
return NULL;
if (isaCls == 0) {
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: getLocalAddresses0
* Signature: (I)[Ljava/net/SocketAddress;
*/
int i, addrCount;
#ifdef __solaris__
#else /* __linux__ */
#endif
return NULL;
}
if (addrCount < 1)
return NULL;
if (isaCls == 0) {
}
return NULL;
}
for (i=0; i<addrCount; i++) {
int port = 0;
else
}
return isaa;
}
int i, addrCount;
#if __solaris__
#else /* __linux__ */
#endif
return NULL;
}
if (addrCount < 1)
return NULL;
if (isaCls == 0) {
}
return NULL;
}
for (i=0; i<addrCount; i++) {
int port;
else
}
return isaa;
}
/*
* Class: sun_nio_ch_SctpNet
* Method: getRemoteAddresses0
* Signature: (II)[Ljava/net/SocketAddress;
*/
}
/* Map the Java level option to the native level */
int mapSocketOption
static struct {
int level;
int optname;
} const opts[] = {
{ sun_nio_ch_SctpStdSocketOption_SCTP_FRAGMENT_INTERLEAVE, IPPROTO_SCTP, SCTP_FRAGMENT_INTERLEAVE },
int i;
return 0;
}
}
/* not found */
return -1;
}
/*
* Class: sun_nio_ch_SctpNet
* Method: setIntOption0
* Signature: (III)V
*/
int result;
void *parg;
int arglen;
"Unsupported socket option");
return;
}
if (opt == sun_nio_ch_SctpStdSocketOption_SO_LINGER) {
if (arg >= 0) {
} else {
}
} else {
}
"sun_nio_ch_SctpNet.setIntOption0");
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: getIntOption0
* Signature: (II)I
*/
int result;
void *arg;
int arglen;
"Unsupported socket option");
return -1;
}
if (opt == sun_nio_ch_SctpStdSocketOption_SO_LINGER) {
} else {
}
"sun.nio.ch.Net.getIntOption");
return -1;
}
else
return result;
}
/*
* Class: sun_nio_ch_SctpNet
* Method: getPrimAddrOption0
* Signature: (II)Ljava/net/SocketAddress;
*/
"sun.nio.ch.SctpNet.getPrimAddrOption0");
return NULL;
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: setPrimAddrOption0
* Signature: (IILjava/net/InetAddress;I)V
*/
int sap_len;
return;
}
"sun.nio.ch.SctpNet.setPrimAddrOption0");
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: setPeerPrimAddrOption0
* Signature: (IILjava/net/InetAddress;I)V
*/
int sap_len;
&sap_len, preferIPv6) != 0) {
return;
}
sizeof(prim)) < 0) {
"sun.nio.ch.SctpNet.setPeerPrimAddrOption0");
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: getInitMsgOption0
* Signature: (I[I)V
*/
&sim_len) < 0) {
"sun.nio.ch.SctpNet.getInitMsgOption0");
return;
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: setInitMsgOption0
* Signature: (III)V
*/
sizeof(sctp_initmsg)) < 0) {
"sun.nio.ch.SctpNet.setInitMsgOption0");
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: shutdown0
* Signature: (II)V
*/
int rv;
/* SctpSocketChannel */
if (assocId < 0) {
return;
}
msg->msg_namelen = 0;
/* Initialize the payload: */
if (assocId > 0) {
}
/* Sum of the length of all control messages in the buffer. */
}
}
/*
* Class: sun_nio_ch_SctpNet
* Method: branch
* Signature: (II)I
*/
int newfd = 0;
}
return newfd;
}