23 * questions.
24 */
25
26 #ifndef NET_UTILS_H
27 #define NET_UTILS_H
28
29 #include "jvm.h"
30 #include "jni_util.h"
31 #include "net_util_md.h"
32
33 /************************************************************************
34 * Macros and misc constants
35 */
36
37 #define MAX_PACKET_LEN 65536
38
39 #define IPv4 1
40 #define IPv6 2
41
42 #define NET_ERROR(env, ex, msg) \
43 { if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg) }
44
45 #define CHECK_NULL(x) if ((x) == NULL) return;
46 #define CHECK_NULL_RETURN(x, y) if ((x) == NULL) return y;
47
48 /************************************************************************
49 * Cached field IDs
50 *
51 * The naming convention for field IDs is
52 * <class abbrv>_<fieldName>ID
53 * i.e. psi_timeoutID is PlainSocketImpl's timeout field's ID.
54 */
55 extern jclass ia_class;
56 extern jfieldID iac_addressID;
57 extern jfieldID iac_familyID;
58 extern jfieldID iac_hostNameID;
59 extern jfieldID ia_preferIPv6AddressID;
60
61 /** (Inet6Address accessors)
62 * set_ methods return JNI_TRUE on success JNI_FALSE on error
63 * get_ methods that return int/boolean, return -1 on error
|
23 * questions.
24 */
25
26 #ifndef NET_UTILS_H
27 #define NET_UTILS_H
28
29 #include "jvm.h"
30 #include "jni_util.h"
31 #include "net_util_md.h"
32
33 /************************************************************************
34 * Macros and misc constants
35 */
36
37 #define MAX_PACKET_LEN 65536
38
39 #define IPv4 1
40 #define IPv6 2
41
42 #define NET_ERROR(env, ex, msg) \
43 { if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg); }
44
45 #define CHECK_NULL(x) if ((x) == NULL) return;
46 #define CHECK_NULL_RETURN(x, y) if ((x) == NULL) return y;
47
48 /************************************************************************
49 * Cached field IDs
50 *
51 * The naming convention for field IDs is
52 * <class abbrv>_<fieldName>ID
53 * i.e. psi_timeoutID is PlainSocketImpl's timeout field's ID.
54 */
55 extern jclass ia_class;
56 extern jfieldID iac_addressID;
57 extern jfieldID iac_familyID;
58 extern jfieldID iac_hostNameID;
59 extern jfieldID ia_preferIPv6AddressID;
60
61 /** (Inet6Address accessors)
62 * set_ methods return JNI_TRUE on success JNI_FALSE on error
63 * get_ methods that return int/boolean, return -1 on error
|