/*
* 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.
*/
#ifndef NET_UTILS_H
#define NET_UTILS_H
#include "jvm.h"
#include "jni_util.h"
#include "net_util_md.h"
/************************************************************************
* Macros and misc constants
*/
/************************************************************************
* Cached field IDs
*
* The naming convention for field IDs is
* <class abbrv>_<fieldName>ID
* i.e. psi_timeoutID is PlainSocketImpl's timeout field's ID.
*/
extern jfieldID iac_addressID;
extern jfieldID iac_familyID;
extern jfieldID iac_hostNameID;
extern jfieldID ia_preferIPv6AddressID;
/* NetworkInterface fields */
extern jfieldID ni_indexID;
extern jfieldID ni_addrsID;
/* PlainSocketImpl fields */
extern jfieldID psi_timeoutID;
extern jfieldID psi_addressID;
extern jfieldID psi_portID;
extern jfieldID psi_localportID;
/* DatagramPacket fields */
extern jfieldID dp_addressID;
extern jfieldID dp_offsetID;
extern jfieldID dp_lengthID;
extern jfieldID dp_bufLengthID;
/* Inet6Address fields */
extern jfieldID ia6_ipaddressID;
extern jfieldID ia6_scopeidID;
extern jfieldID ia6_cachedscopeidID;
extern jfieldID ia6_scopeidsetID;
extern jfieldID ia6_scopeifnameID;
extern jfieldID ia6_scopeifnamesetID;
/************************************************************************
* Utilities
*/
int NET_GetError();
void
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him, int *len, jboolean v4MappedAddress);
void initLocalAddrTable ();
void
int
int
int
int
/* Socket operations
*
* These work just like the JVM_* procedures, except that they may do some
*/
int getScopeID (struct sockaddr *);
int cmpScopeID (unsigned int, struct sockaddr *);
#endif /* NET_UTILS_H */